/*
 * $Header: $
 * $Id$
 *
 * Copyright (c) 2011, Michael DePhillips. All Rights Reserved.
 * This code may not be used without the express written permission
 * of the copyright holder, Michael DePhillips.
 */


package com.facebook.bannermaker.android.activity.makebanner;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;

import com.facebook.bannermaker.android.R;

/**
 * Custom Image View to Create Custom Banner Images
 *
 * @author Michael DePhillips
 * 
 */

public class CustomImageView extends ImageView {

	// Member Variables
    private Drawable m_rectangle;
    private int m_x = 10;
    private int m_y = 100;
    private int m_width = 490;
    private int m_height = 66;
    
    /**
     * @param context
     */
    public CustomImageView(Context context) {
        super(context);
        m_rectangle = getResources().getDrawable(R.drawable.rect);
        m_rectangle.setBounds(m_x, m_y, m_width + m_x, m_height + m_y);
    }
    
    public CustomImageView(Context v, AttributeSet as){ 
        super(v,as);  
        m_rectangle = getResources().getDrawable(R.drawable.rect);
        //m_rectangle = new ShapeDrawable(new RectShape());
        //m_rectangle.getPaint().setColor(R.color.LightBlue);
        m_rectangle.setBounds(m_x, m_y, m_width + m_x, m_height + m_y);
    } 
    
    public int getX () {
        return m_x;
    }
    
    public void setX(int new_x) {
        m_x = new_x;
        m_rectangle.setBounds(m_x, m_y, m_width + m_x, m_height + m_y);
    }
    
    public int getY() {
        return m_y;
    }

    public void setY(int y) {
        m_y = y;
    }

    public int getShapeWidth() {
        return m_width;
    }

    public void setShapeWidth(int width) {
        m_width = width;
    }

    public int getShapeHeight() {
        return m_height;
    }

    public void setShapeHeight(int height) {
        m_height = height;
    }

    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        m_rectangle.draw(canvas);
    }
}